home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / TranslationExtensions.a < prev    next >
Text File  |  1996-05-01  |  5KB  |  161 lines

  1. ;
  2. ;    File:        TranslationExtensions.a
  3. ;
  4. ;    Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5. ;
  6. ;    Version:    Technology:    Macintosh Easy Open 1.1
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__TRANSLATIONEXTENSIONS__') = 'UNDEFINED' THEN
  19. __TRANSLATIONEXTENSIONS__ SET 1
  20.  
  21.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  22.     include 'Memory.a'
  23.     ENDIF
  24.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  25.     include 'Files.a'
  26.     ENDIF
  27.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  28.     include 'Quickdraw.a'
  29.     ENDIF
  30.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  31.     include 'Components.a'
  32.     ENDIF
  33.  
  34. kSupportsFileTranslation        EQU        1
  35. kSupportsScrapTranslation        EQU        2
  36. kTranslatorCanGenerateFilename    EQU        4
  37. ;  better names for 4-char codes
  38. ; typedef OSType                         FileType
  39.  
  40. ; typedef ResType                         ScrapType
  41.  
  42. ; typedef unsigned long                 TranslationAttributes
  43.  
  44.  
  45. taDstDocNeedsResourceFork        EQU        1
  46. taDstIsAppTranslation            EQU        2
  47. FileTypeSpec            RECORD 0
  48. format                     ds.l    1                ; offset: $0 (0)
  49. hint                     ds.l    1                ; offset: $4 (4)
  50. flags                     ds.l    1                ; offset: $8 (8)        ;  taDstDocNeedsResourceFork, taDstIsAppTranslation
  51. catInfoType                 ds.l    1                ; offset: $C (12)
  52. catInfoCreator             ds.l    1                ; offset: $10 (16)
  53. sizeof                     EQU *                    ; size:   $14 (20)
  54.                         ENDR
  55. FileTranslationList        RECORD 0
  56. modDate                     ds.l    1                ; offset: $0 (0)
  57. groupCount                 ds.l    1                ; offset: $4 (4)
  58. ;      unsigned long    group1SrcCount;
  59. ;      unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);
  60. ;   FileTypeSpec    group1SrcTypes[group1SrcCount]
  61. ;   unsigned long    group1DstCount;
  62. ;   unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);
  63. ;   FileTypeSpec    group1DstTypes[group1DstCount]
  64. sizeof                     EQU *                    ; size:   $8 (8)
  65.                         ENDR
  66. ; typedef struct FileTranslationList *    FileTranslationListPtr
  67.  
  68. ; typedef FileTranslationListPtr *        FileTranslationListHandle
  69.  
  70. ScrapTypeSpec            RECORD 0
  71. format                     ds.l    1                ; offset: $0 (0)
  72. hint                     ds.l    1                ; offset: $4 (4)
  73. sizeof                     EQU *                    ; size:   $8 (8)
  74.                         ENDR
  75. ScrapTranslationList    RECORD 0
  76. modDate                     ds.l    1                ; offset: $0 (0)
  77. groupCount                 ds.l    1                ; offset: $4 (4)
  78. ;      unsigned long        group1SrcCount;
  79. ;      unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);
  80. ;   ScrapTypeSpec        group1SrcTypes[group1SrcCount]
  81. ;   unsigned long        group1DstCount;
  82. ;      unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);
  83. ;   ScrapTypeSpec        group1DstTypes[group1DstCount]
  84. sizeof                     EQU *                    ; size:   $8 (8)
  85.                         ENDR
  86. ; typedef struct ScrapTranslationList *    ScrapTranslationListPtr
  87.  
  88. ; typedef ScrapTranslationListPtr *        ScrapTranslationListHandle
  89.  
  90. ;  definition of callbacks to update progress dialog
  91. ; typedef long                             TranslationRefNum
  92.  
  93.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  94. ;
  95. ;****************************************************************************************
  96. ;*
  97. ;* This routine sets the advertisement in the top half of the progress dialog.
  98. ;* It is called once at the beginning of your DoTranslateFile routine.
  99. ;*
  100. ;* Enter:    refNum            Translation reference supplied to DoTranslateFile.
  101. ;*            advertisement    A handle to the picture to display.  This must be non-purgable.
  102. ;*                            Before returning from DoTranslateFile, you should dispose
  103. ;*                            of the memory.  (Normally, it is in the temp translation heap
  104. ;*                            so it is cleaned up for you.)
  105. ;*
  106. ;* Exit:    returns            noErr, paramErr, or memFullErr
  107. ;
  108. ;
  109. ; pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
  110. ;
  111.     IF ¨ GENERATINGCFM THEN
  112.         Macro
  113.         _SetTranslationAdvertisement
  114.             moveq               #2,D0
  115.             dc.w                $ABFC
  116.         EndM
  117.     ELSE
  118.         IMPORT_CFM_FUNCTION SetTranslationAdvertisement
  119.     ENDIF
  120.  
  121. ;
  122. ;****************************************************************************************
  123. ;*
  124. ;* This routine updates the progress bar in the progress dialog.
  125. ;* It is called repeatedly from within your DoTranslateFile routine.
  126. ;* It should be called often, so that the user will get feedback if he tries to cancel.
  127. ;*
  128. ;* Enter:    refNum        translation reference supplied to DoTranslateFile.
  129. ;*            progress    percent complete (0-100)
  130. ;*
  131. ;* Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  132. ;*            returns        noErr, paramErr, or memFullErr
  133. ;
  134. ;
  135. ; pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
  136. ;
  137.     IF ¨ GENERATINGCFM THEN
  138.         Macro
  139.         _UpdateTranslationProgress
  140.             moveq               #1,D0
  141.             dc.w                $ABFC
  142.         EndM
  143.     ELSE
  144.         IMPORT_CFM_FUNCTION UpdateTranslationProgress
  145.     ENDIF
  146.  
  147. ;  ComponentMgr selectors for routines
  148.  
  149. kTranslateGetFileTranslationList EQU    0                    ; component selectors
  150. kTranslateIdentifyFile            EQU        1
  151. kTranslateTranslateFile            EQU        2
  152. kTranslateGetTranslatedFilename    EQU        3
  153. kTranslateGetScrapTranslationList EQU    10                    ; skip to scrap routines
  154. kTranslateIdentifyScrap            EQU        11
  155. kTranslateTranslateScrap        EQU        12
  156. ;  Routines to implment in a file translation extension
  157. ;  Routine to implement in a scrap translation extension
  158.     ENDIF
  159.     ENDIF ; __TRANSLATIONEXTENSIONS__ 
  160.  
  161.